# $Id$
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>

pkgname=kdesu
pkgver=5.50.0
pkgrel=1
pkgdesc='Integration with su for elevated privileges'
arch=(x86_64)
url='https://community.kde.org/Frameworks'
license=(LGPL)
depends=(kservice kpty)
makedepends=(extra-cmake-modules doxygen qt5-tools)
groups=(kf5)
source=("https://download.kde.org/stable/frameworks/${pkgver%.*}/$pkgname-$pkgver.tar.xz"{,.sig})
sha256sums=('6e3c32fd47a65a6592dba36767999ecb50b83edc8c3d5f33f413310a616bbb24'
            'SKIP')
validpgpkeys=(53E6B47B45CEA3E0D5B7457758D0EE648A48B3BB) # David Faure <faure@kde.org>

prepare() {
  mkdir -p build
}

build() {
  cd build
  cmake ../$pkgname-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DCMAKE_INSTALL_LIBEXECDIR=lib \
    -DBUILD_TESTING=OFF \
    -DBUILD_QCH=ON
  make
}

package() {
  cd build
  make DESTDIR="$pkgdir" install

# See FS#44277
  chown :nobody "$pkgdir"/usr/lib/kf5/kdesud
  chmod g+s "$pkgdir"/usr/lib/kf5/kdesud
}
